/*
 * @: 
 * @version: 1.0
 * @Author: ziwei
 * @Date: 2021-11-06 20:45:43
 * @LastEditors: ziwei
 * @LastEditTime: 2021-11-07 15:18:24
 */
function * gen(){
    yield 1;
    yield 2;
    yield 3
}

//处理异常一颗通过it.throw来处理失败
let it = gen();
let r1 = it.next();
console.log(r1);
let r2 = it.throw('出错了') 
//如果是return it.return('提前结束了'),会提前结束done={true}
console.log(r2);

let r3 = it.next();
console.log(r3);